﻿using System;
using Behavioral;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Calculator.MSTest
{
    [TestClass]
    public class AddingTwoPositiveNumbersShouldGiveCorrectResult : UnitTest<Calculator, int>
    {
        [TestMethod]
        public override void Run()
        {
            GivenThat<CalculatorIsDefaultConstructed>()

            .When<AddingTwoNumbers>(13, 45)

            .Then<ResultShouldEqual>(58);
        }
    }

    [TestClass]
    public class AddingNumbersThatCauseOverflowShouldThrowOverflowException : UnitTest<Calculator, int>
    {
        [TestMethod]
        public override void Run()
        {
            GivenThat<CalculatorIsReadyToRun>()
                .And<AddingTwoNumbers>(23, 32)

            .When<AddingTwoNumbers>(int.MaxValue, 1)

            .ThenThrow<OverflowException>();
        }
    }
}
